package com.zzt.pagehelp

import android.widget.LinearLayout
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author: zeting
 * @date: 2022/10/26
 *
 */
class TiXingAdapter<T, U> : BaseQuickAdapter<T, BaseViewHolder>(R.layout.item_tixing),
    LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: T) {
        val tvName = holder.getView<TextView>(R.id.tv_item_text)
        val tvLayout = holder.getView<LinearLayout>(R.id.ll_item_layout)

        tvLayout.setBackgroundColor(RandColor())
        tvName.text = item.toString()
    }


    //随机色
    fun RandColor(): Int {
        val random = java.util.Random()
        return -0x1000000 or random.nextInt(0x00ffffff)
    }
}